package com.weds.edpf.core.web;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import javax.validation.Valid;

import com.weds.core.base.BaseController;
import com.weds.core.annotation.Logs;
import com.weds.core.resp.JsonResult;
import com.weds.core.base.BaseCommPager;
import com.weds.core.base.BasePageSearch;


import com.weds.edpf.core.entity.WtDevLogEntity;
import com.weds.edpf.core.service.WtDevLogService;

/**
 * @Author sxm
 * @Description WtDevLog管理
 * @Date 2020-06-11
 */
@RestController
@RequestMapping(value = "/wtDevLog")
@Api(value = "WtDevLog管理", description = "WtDevLog管理")
public class WtDevLogController extends BaseController {
    @Autowired
    private WtDevLogService wtDevLogService;


    private Logger log = LogManager.getLogger();

    @Logs
    @ApiOperation(value = "新增WtDevLog信息", notes = "新增WtDevLog信息")
    @RequestMapping(value = "/insert", method = RequestMethod.PUT)
    public JsonResult<Object> insert(@RequestBody @Valid WtDevLogEntity record) {
        wtDevLogService.insertSelective(record);
        return succMsg();
    }


    @Logs
    @ApiOperation(value = "批量新增WtDevLog信息", notes = "批量新增WtDevLog信息")
    @RequestMapping(value = "/insertBatch", method = RequestMethod.PUT)
    public JsonResult<Object> insertBatch(@RequestParam String data) {
        List<WtDevLogEntity> list = JSONObject.parseArray(data, WtDevLogEntity.class);
        wtDevLogService.insertBatch(list);
        return succMsg();
    }
}